<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>学生列表 -  学生管理系统</title>
    <meta name="author" content="yinqi">
    <link href="../../css/bootstrap.min.css" rel="stylesheet">
    <link th:href="@{/css/materialdesignicons.min.css}" rel="stylesheet">
    <link href="../../css/style.min.css" rel="stylesheet">
</head>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="../../js/main.min.js"></script>
<script src="../../layer/layer.js"></script>
<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside th:replace="fragment/_fragment::navbar"></aside>


        <!--头部信息-->
        <header th:replace="fragment/_fragment::sidebar"></header>


        <!--页面主要内容-->
        <main class="lyear-layout-content">

            <div class="container-fluid">

                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-toolbar clearfix">
                                <div class="toolbar-btn-action">
                                    <a class="btn btn-primary m-r-5" href="/add/addPage"><i class="mdi mdi-plus"></i>
                                        新增</a>
                                    <form class="form-inline" th:action="@{/student/getConditionPageStudent}" method="get" style="float: right">
                                        <div class="form-group">
                                            <label for="id">学号</label>
                                            <input type="text" name="id" th:value="${condition.id}" class="form-control"  id="id" >
                                        </div>
                                        <div class="form-group">
                                            <label for="name">姓名</label>
                                            <input type="text" name="name" th:value="${condition.name}" class="form-control" id="name" >
                                        </div>

                                        <div class="form-group">
                                            <label for="subject">专业</label>
                                            <input type="text" name="subject" th:value="${condition.subject}" class="form-control" id="subject"  >
                                        </div>
                                        <div class="form-group">
                                            <label for="dept">系别</label>
                                            <input type="text" name="dept"  class="form-control" id="dept" th:value="${condition.dept}"  >
                                        </div>
                                        <button type="submit" class="btn btn-default">查询</button>
                                    </form>
                                </div>
                            </div>
                            <div class="card-body">

                                <div class="table-responsive">
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <th>学号</th>
                                            <th>姓名</th>
                                            <th>年龄</th>
                                            <th>性别</th>
                                            <th>专业</th>
                                            <th>系别</th>
                                            <th>籍贯</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr th:each="student:${students.results}">
                                            <td th:text="${student.id}" style="width: 150px"></td>
                                            <td th:text="${student.name}" style="width: 150px"></td>
                                            <td th:text="${student.age}" style="width: 150px"></td>
                                            <td th:text="${student.sex}" style="width: 150px"></td>
                                            <td th:text="${student.subject}" style="width: 200px"></td>
                                            <td th:text="${student.dept}" style="width: 250px"></td>
                                            <td th:text="${student.addr}" style="width: 250px"></td>
                                            <td>
                                                <div class="btn-group">
                                                    <a class="btn btn-xs btn-default"
                                                       th:href="@{'/update/getById?id='+${student.id}}" title="编辑"
                                                       data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>
                                                    <!--<a class="btn btn-xs btn-default"-->
                                                       <!--th:href="'Javascript:deleteStudent(' + ${ bean.id } + ')'"-->
                                                       <!--data-toggle="tooltip"><i-->
                                                            <!--class="mdi mdi-window-close"></i></a>-->
                                                    <button class="btn btn-xs btn-default" th:onclick= "'deleteStudent('+${ student.id }+')'"><i
                                                            class="mdi mdi-window-close"></i></button>
                                                    <!--<a class="btn btn-default btn-sm" href="Javascript:void(0)" th:onclick= "'javascript : deleteStudent(\'' + ${ bean.id } + '\')'">删除</a>-->
                                                </div>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <nav aria-label="Page navigation" style="text-align: center">
                                    <ul class="pagination">
                                        <!--上一页-->
                                        <li th:if="${students.currentPage!=1}">
                                            <a th:href="@{'/student/getConditionPageStudent?currentPage='+${students.currentPage-1}+'&id='+${condition.id==null?'':condition.id}+'&name='+${condition.name==null?'':condition.name}+'&subject='+${condition.subject==null?'':condition.subject}+'&dept='+${condition.dept==null?'':condition.dept}}" aria-label="Previous">
                                                <span aria-hidden="true">&laquo;</span>
                                            </a>
                                        </li>
                                        <li th:if="${students.currentPage==1}" class="disabled">
                                            <a href="javascript:void(0)" aria-label="Previous">
                                                <span aria-hidden="true">&laquo;</span>
                                            </a>
                                        </li>
                                        <!--中间页码-->
                                        <!--<li th:each="page:${#numbers.sequence(1, students.allPage)}">-->
                                        <!--<a th:href="'/bean/getPageStudent?currentPage='+${page}" th:text="${page}"></a>-->
                                        <!--</li>-->
                                        <li th:each="page:${#numbers.sequence(1,students.currentPage)}" th:if="${students.currentPage!=page}">
                                            <a th:href="@{'/student/getConditionPageStudent?currentPage='+${page}+'&id='+${condition.id==null?'':condition.id}+'&name='+${condition.name==null?'':condition.name}+'&subject='+${condition.subject==null?'':condition.subject}+'&dept='+${condition.dept==null?'':condition.dept}}" th:text="${page}"></a>
                                        </li>
                                        <li th:if="${students.currentPage}" class="active">
                                            <a th:href="@{'/student/getConditionPageStudent?currentPage='+${students.currentPage}+'&id='+${condition.id==null?'':condition.id}+'&name='+${condition.name==null?'':condition.name}+'&subject='+${condition.subject==null?'':condition.subject}+'&dept='+${condition.dept==null?'':condition.dept}}" th:text="${students.currentPage}"></a>
                                        </li>
                                        <li th:each="page2:${#numbers.sequence(students.currentPage, students.allPage)}" th:if="${students.currentPage!=page2}">
                                            <a th:href="@{'/student/getConditionPageStudent?currentPage='+${page2}+'&id='+${condition.id==null?'':condition.id}+'&name='+${condition.name==null?'':condition.name}+'&subject='+${condition.subject==null?'':condition.subject}+'&dept='+${condition.dept==null?'':condition.dept}}" th:text="${page2}"></a>
                                        </li>


                                        <!--下一页-->
                                        <li th:if="${students.currentPage!=students.allPage}">
                                            <a  th:href="@{'/student/getConditionPageStudent?currentPage='+${students.currentPage+1}+'&id='+${condition.id==null?'':condition.id}+'&name='+${condition.name==null?'':condition.name}+'&subject='+${condition.subject==null?'':condition.subject}+'&dept='+${condition.dept==null?'':condition.dept}}" aria-label="Next">
                                                <span aria-hidden="true">&raquo;</span>
                                            </a>
                                        </li>
                                        <li th:if="${students.currentPage==students.allPage}" class="disabled">
                                            <a  href="javascript:void(0)" aria-label="Next">
                                                <span aria-hidden="true">&raquo;</span>
                                            </a>
                                        </li>

                                    </ul>
                                </nav>

                            </div>
                        </div>
                    </div>

                </div>

            </div>

        </main>

    </div>
</div>
<script  th:inline="javascript" type="text/javascript">
    function deleteStudent(id) {

        var ctxPath  = [[@{/}]]
        if(confirm("确定删除吗")){
                location.href=ctxPath+"delete/deleteStudent?id="+id
       }
    }
    function authon(){
        alert("很抱歉,您没有此权限")
        }

</script>
</body>
</html>